package edu.uiuc.ncsa;

//import edu.harvard.cga.gtools.tekml.BaseApp;
//import edu.harvard.cga.gtools.tekml.RewriterException;
//import edu.harvard.cga.gtools.tekml.TransformException;
//import edu.harvard.cga.gtools.tekml.Utils;
//import org.apache.commons.io.FilenameUtils;
//import org.apache.log4j.Logger;

/**
 * @author : Sachith and Upeksha
 * @date : May 12, 2008 - 11:35:15 AM
 */
//public class TEKmlRunner extends BaseApp {
public class TEKmlRunner {

//    static Logger logger = Logger.getLogger("edu.uiuc.ncsa.commons");
//
//    /**
//     * @param configurationFile
//     * @param source
//     * @param destination
//     */
//    public void run(String configurationFile, String source, String destination) {
//
//        File[] sourceFiles = null;
//        File destDir = null;
//
//        try {
//            initializeLogging();
//            loadAppProperties();
//
//            loadConfigProperties(configurationFile);
//
//            String basePath = new File(".").getAbsolutePath();
//            sourceFiles = Utils.getSourceFiles(source, basePath);
//
//            destDir = Utils.getDestinationDir(destination, basePath);
//
//        } catch (Exception e) {
//            System.out.println("Configuration exception.");
//            System.out.println("Application terminated.");
//            e.printStackTrace();
//            System.exit(-1);
//        }
//
//        try {
//            configureTransformer();
//            configureRewriter();
//            run(sourceFiles, destDir);
//
//            String tempPath = FilenameUtils.concat(destDir.getAbsolutePath(), "tekml-temp.kml");
//
//
//        } catch (RewriterException e) {
//            logger.error("Processing incomplete. " + e);
//        } catch (TransformException e) {
//            logger.error("Processing incomplete due to ogr transform error. " + e);
//        } catch (RuntimeException e) {
//            e.printStackTrace();
//            logger.error("Processing incomplete. " + e);
//        }
//
//        logger.info("teKML application completed ");
//    }
//
//    public static void main(String[] args) {
//
//        String configFile = "resources/teKML/sample_shape_file_config.properties";
//        String source = "test-resources/shape-files/ILRivBasin-weather-stations/ILRivBasin-weather-stations.shp";
//        File destinationFile = new File("tekml-output");
//
//        if (!destinationFile.isDirectory()) {
//            destinationFile.mkdir();
//        }
//
//        TEKmlRunner teKmlRunner = new TEKmlRunner();
//        teKmlRunner.run(configFile, source, destinationFile.getName());
//    }

}
